MSword OleMethod errors

my debug code outputs these errors:

moveup Problem with OLE Argument names.

endkey OLE problem: Bad parameter

InsertColumnsRight Problem with OLE Argument names.

for this DXL Code:

// move up into table
// Selection.MoveUp Unit:=wdLine, Count:=1

clear MSAutoArgs
put(MSAutoArgs, 1)
s = oleMethod(objDoc,"MoveUp", MSAutoArgs)
print "moveup\t"s"\n"

//move to end of table
//To move to the end of the current line:
// Selection.EndKey Unit:=wdLine

clear MSAutoArgs
put(MSAutoArgs, 1)
s= oleMethod(objSel, "EndKey",MSAutoArgs)
print "endkey\t"s"\n"
//add column to table
// Selection.InsertColumnsRight

clear MSAutoArgs
s = oleMethod(objMSTables, "InsertColumnsRight",MSAutoArgs)
print "InsertColumnsRight\t"s"\n"

the word.dxl code doesn't help me with these methods.

Thanks in advance...
johnkeven - Thu Jul 28 12:59:42 EDT 2011

Re: MSword OleMethod errors
johnkeven - Fri Jul 29 11:26:47 EDT 2011

instead of using "InsertColumnsRight"
I'm trying to use the Add method to insert a column;
can't get this to work either?? any clues as to why this isn't working?:

//add column to table
// Set myTable = ActiveDocument.Tables(1)

oleGet(objDoc,"Tables", objMSTables)
oleGet(objMSTables,"Table", objMSTable)
oleGet(objMSTable,"Columns",ObjColumns)

// myTable.Columns.Add BeforeColumn:=myTable.Columns(1)

clear MSAutoArgs
put(MSAutoArgs, depthMax)
s = oleMethod(ObjColumns, "Add", MSAutoArgs)
print "ADD\t"s"\n"

Re: MSword OleMethod errors
achao - Sat Aug 27 04:00:42 EDT 2011

johnkeven - Fri Jul 29 11:26:47 EDT 2011
instead of using "InsertColumnsRight"
I'm trying to use the Add method to insert a column;
can't get this to work either?? any clues as to why this isn't working?:

//add column to table
// Set myTable = ActiveDocument.Tables(1)

oleGet(objDoc,"Tables", objMSTables)
oleGet(objMSTables,"Table", objMSTable)
oleGet(objMSTable,"Columns",ObjColumns)

// myTable.Columns.Add BeforeColumn:=myTable.Columns(1)

clear MSAutoArgs
put(MSAutoArgs, depthMax)
s = oleMethod(ObjColumns, "Add", MSAutoArgs)
print "ADD\t"s"\n"

To add a column to a Word table, the VBA is
expression.Add(BeforeColumn)
where expression is a Columns object and BeforeColumn is a Column object.
The method returns a Column object that is the column added.

You can either set the BeforeColumn to a column by using something like myTable.Columns(1) in VBA or go to a cell then selecting the Column property. You would supply the Column object as part of the
put(MSAutoArgs,...)

Basically something like this works for your code
OleAutoObj objColumn = null
clear MSAutoArgs
oleMethod(ObjColumns, "Add", MSAutoArgs, objColumn)